package cn.com.taurus.controller.major;

import cn.com.taurus.bean.FundManagerWebBean;
import cn.com.taurus.biz.FundCompanyBiz;
import cn.com.taurus.biz.FundManagerWebBeanBiz;
import cn.com.taurus.controller.user.MyPurseController;
import cn.com.taurus.entity.Fund;
import cn.com.taurus.entity.FundCompany;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class FundCompanyWebController {

    @Autowired
    FundCompanyBiz fundCompanyBiz;
    @Autowired
    MyPurseController myPurseController;

    @RequestMapping(value = "/Anonymous/Financechien2")
    public ModelAndView Financechien2(HttpServletRequest request, HttpServletResponse response)throws Exception{
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=UTF-8");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("fundCompanyTopByDescList",fundCompanyBiz.fundCompanyTopByDesc());
        modelAndView.setViewName("major/Financechien2");
        System.err.println(myPurseController.getMyPurseWebBean()+"55555555555555");
        modelAndView.addObject("myPurseData",myPurseController.getMyPurseWebBean());
        return modelAndView;
    }
    @RequestMapping(value="/Anonymous/newFundCompany")
    public ModelAndView newFundCompany(HttpServletRequest request, HttpServletResponse response) throws Exception {
        FundCompany fundCompany =new FundCompany();
        String fcName = request.getParameter("fcName");
        fundCompany.setFcName(fcName);
        System.out.println(fundCompany);
        System.out.println(fundCompanyBiz.fundCompanyByFcName(fundCompany));

        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("myPurseData",myPurseController.getMyPurseWebBean());
        modelAndView.setViewName("major/Financechient");
        modelAndView.addObject("fundCompany",fundCompanyBiz.fundCompanyByFcName(fundCompany));
        return modelAndView;
    }
}
